<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
        margin: 0px;
    }
    .box{
        width: 100px;
        height: 100px;
        background-color: red;
        border: 5px solid;
        padding: 10px;
        /* margin-left: 50px; */
        position: absolute;
        left: 50px;
        top: 50px;
    }
    .container{
        width: 100px;
        height: 2000px;
        background: blue;
    }
    </style>
    </head>
</head>
<body>
    <div class="container"></div>
    <div class="box"></div>
    <script>
        var boxEle = document.querySelector(".box")
        var res = boxEle.getClientRects();
        console.log(res);

        /* 
        1.width 和 height :  和  offsetWidth  offsetHeight 类似  :自身宽高 + padding
         + border 
        2.left/x 元素距离左边相对浏览器(视口viewport)的偏移量
        top/y 元素距离浏览器上边的偏移量
        3.right : 左边偏移量 + 自身 + border + padding 的距离         
                     50px    100px     10px   20px = 180px
        bottom :上面的偏移量 + 自身 + border + padding距离      
                    0        100px    10px      20px =  130px

        */
    </script>
</body>
</html>